load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//vscode-ng-language-service/integration/project:ng-packagr/package_json.bzl", ng_packagr_bin = "bin")

npm_link_all_packages(name = "node_modules")

copy_to_bin(
    name = "project_srcs",
    srcs = glob(["**"]),
)

ng_packagr_bin.ng_packagr(
    name = "dist",
    srcs = [
        ":node_modules",
        ":project_srcs",
    ],
    args = [
        "-p",
        "libs/post/ng-package.json",
        "-c",
        "libs/post/tsconfig.json",
    ],
    chdir = package_name(),
    out_dirs = ["dist"],
)

filegroup(
    name = "project",
    srcs = [
        ":dist",
        ":project_srcs",
    ],
    visibility = ["//vscode-ng-language-service/integration:__subpackages__"],
)
